/**
 * AUTHOR: Zhou Yu <pepsior@163.com>
 *
 * COPYRIGHT(C) 2011 Zhou Yu. ALL RIGHTS RESERVED.
 */
#pragma once
#ifndef XL_ERROR_H_INCLUDED
#define XL_ERROR_H_INCLUDED

#include <wchar.h>

/* Errors */
enum
{
    XL_EOK, 
    XL_ENOMEM, 
    XL_EPATCHED, 
    XL_EUNFOUND, 
    XL_EUNSUPPORTED, 
    XL_EUNACCESSIBLE, 
    XL_EUNMATCHED, 

    XL_ECOUNT
};

/* Check errors */
#define XL_SUCC(error)      ((error) == XL_EOK)
#define XL_FAIL(error)      ((error) != XL_EOK)

/* Quick returns */
#define XL_RETE(error)                                      \
    do { if(XL_FAIL(error)) return (error); }               \
    __pragma(warning(push)) __pragma(warning(disable:4127)) \
    while(0)                                                \
    __pragma(warning(pop))

/* Get the description of error. */
const wchar_t *xl_error_get_desc(int error);

#endif      /* #ifndef XL_ERROR_H_INCLUDED */

